package IO.io_5_9;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

/**
 * @author bruin_du
 * @description 文件内容的读写
 * @date 2022/5/11 22:41
 **/
public class ReadFile3 {
    public static void main(String[] args) {
        try(InputStream is = new FileInputStream("hello.txt")){
            byte[] arr = new byte[1024];
            while(true){
                int n = is.read(arr);
                if(n == -1){
                    break;
                }
                System.out.println(Arrays.toString(Arrays.copyOf(arr,n)));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
